home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 21 Jan. 1997
- // Author: corban gossett
- //
- //
- // Procedure Name:
- //
- // hyperUserInit.mel
- //
- // Description:
- //
- // If this script is in your script path, this will allow for simple
- // hypergraph editing. This will work in the "DG" mode of the hypergraph
- // and will allow the ability to build shader networks and other graph
- // editing for 1.0. Have fun..... corban
- //
- // Input Arguments:
- //
- // Return Value:
- //
-
- global proc nodePressCallback(string $editor, string $node)
- {
- //
- // Description:
- // Callback when node is pressed
- }
-
- global proc nodeReleaseCallback(string $editor, string $node, string $mod)
- {
- //
- // Description:
- // Callback when node is released
- }
-
- global proc nodeDropCallback(string $editor, string $srcNode, string $dstNode, string $mod)
- {
- //
- // Description:
- // Callback when node is dropped on another node
-
- string $graphType = `hyperGraph -q -graphType $editor`;
-
- if ($mod == "shift") {
- connectWindowWith $srcNode $dstNode;
- } else {
- defaultNavigation -f true -ce -s $srcNode -d $dstNode;
- }
- }
-
- global proc nodeDblClickCallback(string $editor, string $node)
- {
- //
- // Description:
- // Callback when node is double clicked
-
- hyperGraph -e -attributeEditor single $editor;
- }
-
- global proc edgePressCallback(string $editor, string $edge)
- {
- //
- // Description:
- // Callback when edge is pressed
- }
-
- global proc edgeReleaseCallback(string $editor, string $edge)
- {
- //
- // Description:
- // Callback when edge is released
- }
-
- global proc edgeDropCallback(string $editor, string $edge)
- {
- //
- // Description:
- // Callback when edge is dropped on another edge
- }
-
- global proc edgeDblClickCallback(string $editor, string $edge)
- {
- //
- // Description:
- // Callback when edge is double clicked
-
- global string $fromAttr;
- $fromAttr = `hyperGraph -q -fromAttr $editor`;
- global string $toAttr;
- $toAttr = `hyperGraph -q -toAttr $editor`;
-
- connectWindowWith $fromAttr $toAttr;
-
- }
-
- global proc edgeDimmedDblClickCallback(string $editor, string $edge)
- {
- //
- // Description:
- // Callback when a dimmed edge is double clicked
-
- minorNodesWindow;;
- }
-
-
- global proc nodeConnectCallback(string $editor, string $srcNode, string $dstNode, string $direction, string $mod)
- {
- //
- // Description:
- // Callback when connect request is made by connecting edge
-
- global string $fromAttr;
- $fromAttr = `hyperGraph -q -fromAttr $editor`;
- global string $toAttr;
- $toAttr = `hyperGraph -q -toAttr $editor`;
-
- global string $outliner;
-
-
- if ($direction == "from")
- {
- if (!`window -exists hyperConnectWin`)
- {
- window -ret -title ($srcNode + " -->") -wh 200 450 hyperConnectWin;
- formLayout myForm;
-
- $outliner = `nodeOutliner`;
-
- formLayout -e
- -af $outliner top 0
- -af $outliner left 0
- -af $outliner right 0
- -af $outliner bottom 0
- myForm;
- }
- else
- {
- window -e -title ($srcNode + " -->") hyperConnectWin;
- nodeOutliner -e -rma $outliner;
- }
-
- showWindow hyperConnectWin;
- nodeOutliner -e -sh true -snk true -si true -connectivity $toAttr -a $srcNode -so true -snk true $outliner;
- nodeOutliner -e -sc "outSelected" $outliner;
-
-
- }
- else
- {
- if (!`window -exists hyperConnectWin`)
- {
- window -ret -title ("--> " + $dstNode) -wh 200 450 hyperConnectWin;
- formLayout myForm;
-
- $outliner = `nodeOutliner`;
-
- formLayout -e
- -af $outliner top 0
- -af $outliner left 0
- -af $outliner right 0
- -af $outliner bottom 0
- myForm;
- }
- else
- {
- window -e -title ("--> " + $dstNode) hyperConnectWin;
- nodeOutliner -e -rma $outliner;
- }
-
- showWindow hyperConnectWin;
- nodeOutliner -e -sh true -snk true -si true -connectivity $fromAttr -a $dstNode -so true -snk true $outliner;
- nodeOutliner -e -sc "inSelected" $outliner;
- }
- }
-
- global proc disconnectCallback(string $editor, string $srcAttr, string $dstAttr)
- {
- //
- // Description:
- // Callback when delete connection request is made
- disconnectAttr $srcAttr $dstAttr;
- }
-
-
- // global proc used for the above proc. (nodeConnectCallback)
- // Called from nodeConnectCallback.
- //
-
- global proc inSelected ()
- {
- global string $outliner;
- global string $fromAttr;
- global string $toAttr;
- string $inAttrSelected[0];
- $inAttrSelected = `nodeOutliner -q -cs $outliner`;
- disconnectAttr $fromAttr $toAttr;
- print("// Result: disconnected " + $fromAttr + " from " + $toAttr + "\n");
- int $length = `size $inAttrSelected`;
- if( $length > 0 ) {
- connectAttr $fromAttr $inAttrSelected[0];
- print("// Result: connected " + $fromAttr + " to " + $inAttrSelected[0] + "\n");
- }
- window -e -visible false hyperConnectWin;
-
- }
-
- global proc outSelected ()
- {
- global string $outliner;
- global string $fromAttr;
- global string $toAttr;
- string $outAttrSelected[0];
- $outAttrSelected = `nodeOutliner -q -cs $outliner`;
- disconnectAttr $fromAttr $toAttr;
- print("// Result: disconnected " + $fromAttr + " from " + $toAttr + "\n");
- int $length = `size $outAttrSelected`;
- if( $length > 0 ) {
- connectAttr $outAttrSelected[0] $toAttr;
- print("// Result: connected " + $outAttrSelected[0] + " to " + $toAttr + "\n");
- }
- window -e -visible false hyperConnectWin;
-
- }
-
- global proc
- hyperUserInit ( string $editor )
- {
- hyperGraph -e
- -nodePressCommand nodePressCallback
- -nodeReleaseCommand nodeReleaseCallback
- -nodeDropCommand nodeDropCallback
- -edgePressCommand edgePressCallback
- -edgeReleaseCommand edgeReleaseCallback
- -edgeDropCommand edgeDropCallback
- -edgeDblClickCommand edgeDblClickCallback
- -edgeDimmedDblClickCommand edgeDimmedDblClickCallback
- -nodeConnectCommand nodeConnectCallback
- -breakConnectionCommand disconnectCallback
- $editor;
-
- // only put the double-click event on HyperShade and Visor
- //
- string $type = `hyperGraph -query -graphType $editor`;
- if ( $type != "DAG" && $type != "DG" ){
- hyperGraph -e
- -nodeDblClickCommand nodeDblClickCallback
- $editor;
- }
- }
-
-
-
-